<?php
class ContentController extends AppController {
	var $name = 'Content';
	var $helpers = array();
	var $components = array('Menu','Init');

	function beforeFilter() {
		$this->Init->startup($this);
		$this->Init->init();
		$this->Init->getKeyword();
		$_session = $this -> Session -> read();
		$this->loadModel('Hitcounter');
		$row = $this->Hitcounter->get(session_id());
		if ($row == 0) {
			$data = array(
				"session_id" => session_id(),
				"ref_url" => env("REQUEST_URI"),
				"ip_address" => env("REMOTE_ADDR"),
				"activity" => date("Y-m-d H:i:s")
			);
			$this->Hitcounter->save($data);
		}
               
		$this->set('activeNav','About');
		Configure::write("Config.language", 'vie');
		$this->set('lang','vie');
	}

	function about() {

		$this->layout = 'inside';
		
		// get menus
		$this->loadModel('Content');

		$menus = $this->Content->find('first', array(
				'conditions' => array('Content.id' => 1)
		));
		$this->set('content',$menus);
		$this->render('index');
	}

	function instruction() {

		$this->layout = 'inside';

		// get menus
		$this->loadModel('Content');

		$menus = $this->Content->find('first', array(
				'conditions' => array('Content.id' => 4)
		));
		$this->set('content',$menus);
		$this->render('index');
	}
}
?>
